
(defparameter *ed-unroll-structs*
  '(marked-code

    ;; describe Animal type
    (type Animal
     (int legs)
     (int claws)
     (int ears))

    ;; describe function that performs shallow visiting of the structure's members
    (func shallow-visit (instance visit)
     ;; type-of is compile-time function
     (let (type (type-of instance))
       (case (get kind type)
         pointer (error "pointer is not expected")
         
         builtin (visit instance stream)

         complex (foreach (field (get fields type))
                          (shallow-visit stream (get field instance)))
         
         default (error))))

    ;; shallow serializer
    (func shallow-serialize (stream instance)
     (let (visit (lambda (stream instance) (serialize stream instance)))
       ;; FIXME: do it?? -        (put-constraint visit compile-time)
       (shallow-visit instance visit)))

    ;; eof
    (nop)))



